#include<stdio.h>
#include<unistd.h>
#include<string.h>

#define NUM 102

int main()
{
    char bar[NUM];
    memset(bar, 0, sizeof(bar));
    int n = 0;
    const char* p = "|/-\\";
    while(n <= 100)
    {
        printf("[%-100s][%d%%] %c\r", bar, n, p[n % 4]);
        bar[n++] = '#';
        fflush(stdout);
        usleep(40000);
    }
    printf("\n");
    return 0;
}
